styleproperty: require property in _gtk_style_property_parse_value()
authorBenjamin Otte <otte@redhat.com>
Sun, 1 Jan 2012 23:14:23 +0000 (00:14 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 9 Jan 2012 17:37:53 +0000 (18:37 +0100)
Other code uses _gtk_css_style_parse_value() instead now.

gtk/gtkcssprovider.c
gtk/gtkcssshorthandpropertyimpl.c
gtk/gtkstyleproperty.c

index 102708697f82afeb59bd66c5c3e98dd27a56bb7f..e15861ef28257fe5d4034157cfde39cef5328853 100644 (file)
@@ -28,6 +28,7 @@
 #include "gtkcssproviderprivate.h"
 
 #include "gtkbitmaskprivate.h"
+#include "gtkcssstylefuncsprivate.h"
 #include "gtkcssparserprivate.h"
 #include "gtkcsssectionprivate.h"
 #include "gtkcssselectorprivate.h"
@@ -1485,10 +1486,9 @@ gtk_css_provider_get_style_property (GtkStyleProvider *provider,
                                          gtk_css_section_get_file (val->section),
                                          g_value_get_string (&val->value));
 
-          found = _gtk_style_property_parse_value (NULL,
-                                                   value,
-                                                   scanner->parser,
-                                                   NULL);
+          found = _gtk_css_style_parse_value (value,
+                                              scanner->parser,
+                                              NULL);
 
           gtk_css_scanner_destroy (scanner);
 
index 023a38fb4bcbb18016d449ebd104fc6ae872e371..a658efd62b0960b08f381eb45b1efa9ec0188813 100644 (file)
@@ -26,6 +26,7 @@
 #include <math.h>
 
 #include "gtkborderimageprivate.h"
+#include "gtkcssstylefuncsprivate.h"
 #include "gtkcsstypesprivate.h"
 
 /* this is in case round() is not provided by the compiler, 
@@ -54,7 +55,7 @@ border_image_value_parse (GtkCssParser *parser,
 
   g_value_init (&temp, CAIRO_GOBJECT_TYPE_PATTERN);
 
-  if (!_gtk_style_property_parse_value (NULL, &temp, parser, base))
+  if (!_gtk_css_style_parse_value (&temp, parser, base))
     return FALSE;
 
   boxed_type = G_VALUE_TYPE (&temp);
@@ -66,7 +67,7 @@ border_image_value_parse (GtkCssParser *parser,
   g_value_unset (&temp);
   g_value_init (&temp, GTK_TYPE_BORDER);
 
-  if (!_gtk_style_property_parse_value (NULL, &temp, parser, base))
+  if (!_gtk_css_style_parse_value (&temp, parser, base))
     goto out;
 
   parsed_slice = g_value_get_boxed (&temp);
@@ -77,7 +78,7 @@ border_image_value_parse (GtkCssParser *parser,
       g_value_unset (&temp);
       g_value_init (&temp, GTK_TYPE_BORDER);
 
-      if (!_gtk_style_property_parse_value (NULL, &temp, parser, base))
+      if (!_gtk_css_style_parse_value (&temp, parser, base))
         goto out;
 
       width = g_value_dup_boxed (&temp);
@@ -86,7 +87,7 @@ border_image_value_parse (GtkCssParser *parser,
   g_value_unset (&temp);
   g_value_init (&temp, GTK_TYPE_CSS_BORDER_IMAGE_REPEAT);
 
-  if (!_gtk_style_property_parse_value (NULL, &temp, parser, base))
+  if (!_gtk_css_style_parse_value (&temp, parser, base))
     goto out;
 
   parsed_repeat = g_value_get_boxed (&temp);
index 1c638b3ba3c1910158951b1cf511af07837b7f7d..b444cf104a85e6908cb3b4995a553b793c717efb 100644 (file)
@@ -385,56 +385,53 @@ _gtk_style_property_parse_value (GtkStyleProperty *property,
                                  GtkCssParser     *parser,
                                  GFile            *base)
 {
+  g_return_val_if_fail (GTK_IS_STYLE_PROPERTY (property), FALSE);
   g_return_val_if_fail (value != NULL, FALSE);
   g_return_val_if_fail (parser != NULL, FALSE);
 
-  if (property)
+  if (_gtk_css_parser_try (parser, "initial", TRUE))
     {
-      if (_gtk_css_parser_try (parser, "initial", TRUE))
-        {
-          /* the initial value can be explicitly specified with the
-           * ‘initial’ keyword which all properties accept.
-           */
-          g_value_unset (value);
-          g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
-          g_value_set_enum (value, GTK_CSS_INITIAL);
-          return TRUE;
-        }
-      else if (_gtk_css_parser_try (parser, "inherit", TRUE))
-        {
-          /* All properties accept the ‘inherit’ value which
-           * explicitly specifies that the value will be determined
-           * by inheritance. The ‘inherit’ value can be used to
-           * strengthen inherited values in the cascade, and it can
-           * also be used on properties that are not normally inherited.
-           */
-          g_value_unset (value);
-          g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
-          g_value_set_enum (value, GTK_CSS_INHERIT);
-          return TRUE;
-        }
-      else if (property->property_parse_func)
-        {
-          GError *error = NULL;
-          char *value_str;
-          gboolean success;
-          
-          value_str = _gtk_css_parser_read_value (parser);
-          if (value_str == NULL)
-            return FALSE;
-          
-          success = (*property->property_parse_func) (value_str, value, &error);
-
-          g_free (value_str);
-
-          return success;
-        }
-
-      if (property->parse_func)
-        return (* property->parse_func) (parser, base, value);
+      /* the initial value can be explicitly specified with the
+       * ‘initial’ keyword which all properties accept.
+       */
+      g_value_unset (value);
+      g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
+      g_value_set_enum (value, GTK_CSS_INITIAL);
+      return TRUE;
     }
-
-  return _gtk_css_style_parse_value (value, parser, base);
+  else if (_gtk_css_parser_try (parser, "inherit", TRUE))
+    {
+      /* All properties accept the ‘inherit’ value which
+       * explicitly specifies that the value will be determined
+       * by inheritance. The ‘inherit’ value can be used to
+       * strengthen inherited values in the cascade, and it can
+       * also be used on properties that are not normally inherited.
+       */
+      g_value_unset (value);
+      g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
+      g_value_set_enum (value, GTK_CSS_INHERIT);
+      return TRUE;
+    }
+  else if (property->property_parse_func)
+    {
+      GError *error = NULL;
+      char *value_str;
+      gboolean success;
+      
+      value_str = _gtk_css_parser_read_value (parser);
+      if (value_str == NULL)
+        return FALSE;
+      
+      success = (*property->property_parse_func) (value_str, value, &error);
+
+      g_free (value_str);
+
+      return success;
+    }
+  else if (property->parse_func)
+    return (* property->parse_func) (parser, base, value);
+  else
+    return _gtk_css_style_parse_value (value, parser, base);
 }
 
 GParameter *